package com.toocms.jinjuhang.ui.mine.receiver_address

import com.toocms.jinjuhang.R
import com.toocms.jinjuhang.BR
import com.toocms.jinjuhang.databinding.FgtEditReceiverAddressBinding
import com.toocms.jinjuhang.ui.base.BaseFgt
import com.toocms.tab.TooCMSApplication

class EditReceiverAddressFgt : BaseFgt<FgtEditReceiverAddressBinding, EditReceiverAddressModel>() {
    override fun onFragmentCreated() {
        topBar.setTitle(R.string.str_receiver_address)
    }

    override fun getLayoutResId() = R.layout.fgt_edit_receiver_address

    override fun getVariableId() = BR.editReceiverAddressModel

    override fun viewObserver() {
        viewModel.addressChangeSingleLiveEvent.observe(this) {
            binding.detailsAddressEdt.apply {
                requestFocus()
                requestFocusFromTouch()
                setText(
                    it as CharSequence
                )
                setSelection(text.length)
            }
        }
    }

    override fun getViewModel() = EditReceiverAddressModel(TooCMSApplication.getInstance(),arguments)
}